// import {
//   HashRouter,
//   Route,
// } from 'react-router-dom'
// import React from 'react'
// import Home from '../views/home/Home'

// const TodoListRouter = () => {
//   return (    
//     <HashRouter>
//       <Route path="/home" component = {Home} />
//     </HashRouter>
//   )
// }
// export default TodoListRouter



import React, { Component } from 'react'
import {
  HashRouter as Router,
  Route,
  Switch,
  Redirect
} from 'react-router-dom'
import Login from '../views/login/Login'
import Home from '../views/home/Home'
export default class TodoListRouter extends Component {
  render() {
    return (
      <Router>
        <Switch>
          <Route path = "/login" component = { Login }></Route>
          <Route path = "/" render={()=>(
            localStorage.getItem("isLogin")==="true"?
            <Home />
            :
            <Redirect to="/login" />
          )}>
          </Route>
        </Switch>
      </Router>
    )
  }
}